#ifndef X_6_H
#define X_6_H

#include "common.h"

template <AllegroVersion version>
struct x06
{
    uint32_t t;
    uint32_t k;

    // Pointer to x06
    uint32_t next;

    // Pointer to string
    uint32_t ptr1;

    uint32_t ptr2;

    // Points to instance
    uint32_t ptr3;

    // Points to footprint
    uint32_t ptr4;

    // Points to x08
    uint32_t ptr5;

    // Points to x03, schematic symbol (e.g. RESISTOR)
    uint32_t ptr6;

    // Added in 17.x?
#if __cplusplus >= 202002L
    COND_FIELD(version >= A_172, uint32_t, un2);
#endif
    uint32_t TAIL;
    operator x06<A_174>() const;
    static constexpr AllegroVersion versions[1] = {A_172};
};

#if __cplusplus < 202002L
template <> struct x06<A_172>
{
    uint32_t t;
    uint32_t k;

    // Pointer to x06
    uint32_t next;

    // Pointer to string
    uint32_t ptr1;

    uint32_t ptr2;

    // Points to instance
    uint32_t ptr3;

    // Points to footprint
    uint32_t ptr4;

    // Points to x08
    uint32_t ptr5;

    // Points to x03, schematic symbol (e.g. RESISTOR)
    uint32_t ptr6;

    // Added in 17.x?
    uint32_t un2;

    uint32_t TAIL;
    operator x06<A_174>() const;
    static constexpr AllegroVersion versions[1] = {A_172};
};
template <> struct x06<A_174> : x06<A_172> {};
#endif

static_assert(sizeof_until_tail<x06<A_160>>() == 36);
static_assert(sizeof_until_tail<x06<A_172>>() == 40);

#endif // X_6_H
